package com.ouc.service.impl;

import com.ouc.entity.ShippingAddress;
import com.ouc.mapper.ShippingAddressMapper;
import com.ouc.service.ShippingAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.ws.ServiceMode;
import java.util.List;

/**
 * @Name: ShippingServiceImpl
 * @Description:
 * @Author: Mr.Tong
 */
@Service
public class ShippingAddressServiceImpl implements ShippingAddressService {

    @Autowired
    private ShippingAddressMapper shippingAddressMapper;

    @Override
    public Boolean existAddress(ShippingAddress shippingAddress) {
        return shippingAddressMapper.getAddress(shippingAddress) != null;
    }

    @Override
    public Boolean insertAddress(ShippingAddress shippingAddress) {
        return shippingAddressMapper.insertAddress(shippingAddress);
    }

    @Override
    public List<ShippingAddress> getAllAddress(Integer userId) {
        return shippingAddressMapper.getAllAddress(userId);
    }

    @Override
    public Boolean deleteAddress(Integer id) {
        return shippingAddressMapper.deleteAddress(id);
    }
}
